package com.cowealth.platform.common.db.injector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.cowealth.platform.common.db.injector.method.InsertByBatch;

import java.util.List;

/**
 * 自定义 Sql 注入器，继承 MybatisPlus 提供的默认注入器，
 * 见官方示例：https://gitee.com/baomidou/mybatis-plus-samples/tree/master/mybatis-plus-sample-deluxe
 *
 * 文档见https://baomidou.com/guide/sql-injector.html
 *
 * @author : skycdm
 * @version : 1.0.0
 * @date : 2021/1/19 15:26
 */
public class CustomSqlInject extends DefaultSqlInjector {

    /**
     * 注册自定义方法
     * @return
     */
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
        //只需增加方法，保留MP自带方法，用super.getMethodList() 再add
        List<AbstractMethod> methodList = super.getMethodList(mapperClass);
        methodList.add(new InsertByBatch());
        return methodList;
    }

}
